#include <stdio.h>
#include <stdlib.h>

typedef struct BTree{
    char Elment;
    struct BTree *left;
    struct BTree *right;
}Tree;


struct BTree *makeTree(char Elm)
{
    Tree *Node = (Tree *)malloc(sizeof(struct BTree));
    Node->Elment = Elm;
    Node->left = NULL;
    Node->right = NULL;
    return Node;
}


void printTreePre(Tree *Node)
{
    if (Node == NULL) {
        return;
    }
    printf("%c ",Node->Elment);
    printTreePre(Node->left);
    printTreePre(Node->right);
}

void printTreeIn(Tree *Node)
{
    if (Node == NULL) {
        return;
    }
    printTreeIn(Node->left);
    printf("%c ",Node->Elment);
    printTreeIn(Node->right);
}
void printTreeB(Tree *Node)
{
    if (Node == NULL) {
        return;
    }
    printTreeB(Node->left);
    printTreeB(Node->right);
    printf("%c ",Node->Elment);
}

int main()
{
    struct BTree *root = makeTree('A');
    root->left = makeTree('B');
    root->right = makeTree('C');
    root->left->left = makeTree('D');
    root->left->right = makeTree('F');
    root->left->right->left = makeTree('G');
    root->left->right->right = makeTree('H');
    root->left->right->left->left = makeTree('I');
    root->left->right->left->right = makeTree('J');
    printTreePre(root);
    printf("\n");
    printTreeIn(root);
    printf("\n");
    printTreeB(root);
    return 0;
}
